#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/6/15 10:26
# @Author : 闫峰
# @File    : baseutils.py
from common.setting import ensure_path_sep
from utils.mysqlUtils.db_pool import Database


def get_token(OrderSourceId):
    znkd_db = Database(ensure_path_sep("\\config\\znkd_mysql_config.yaml"), "znkd_database_prod")
    sql = """SELECT UserTokenSecretAccessKey  FROM sys_ordersource_authorization WHERE CustomerId=1 AND OrderSourceId=%s;"""
    res = znkd_db.fetch_all(sql, (OrderSourceId,))
    return "Bearer " + res[0]['UserTokenSecretAccessKey']

